3 research outputs found
Types and Semantics for Extensible Data Types (Extended Version)
Developing and maintaining software commonly requires (1) adding new data
type constructors to existing applications, but also (2) adding new functions
that work on existing data. Most programming languages have native support for
defining data types and functions in a way that supports either (1) or (2), but
not both. This lack of native support makes it difficult to use and extend
libraries. A theoretically well-studied solution is to define data types and
functions using initial algebra semantics. While it is possible to encode this
solution in existing programming languages, such encodings add syntactic and
interpretive overhead, and commonly fail to take advantage of the map and fold
fusion laws of initial algebras which compilers could exploit to generate more
efficient code. A solution to these is to provide native support for initial
algebra semantics. In this paper, we develop such a solution and present a type
discipline and core calculus for a language with native support for initial
algebra semantics.Comment: Extended version (28 pages) of the eponymous paper to appear in the
conference proceedings of APLAS 202
A completely unique account of enumeration
How can we enumerate the inhabitants of an algebraic datatype? This paper explores a datatype generic solution that works for all regular types and indexed families. The enumerators presented here are provably both complete and unique—they will eventually produce every value exactly once—and fair—they avoid bias when composing enumerators. Finally, these enumerators memoise previously enumerated values whenever possible, thereby avoiding repeatedly recomputing recursive results
A completely unique account of enumeration
How can we enumerate the inhabitants of an algebraic datatype? This paper explores a datatype generic solution that works for all regular types and indexed families. The enumerators presented here are provably both complete and unique—they will eventually produce every value exactly once—and fair—they avoid bias when composing enumerators. Finally, these enumerators memoise previously enumerated values whenever possible, thereby avoiding repeatedly recomputing recursive results